package cn.itsource.controller.app;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.itsource.pojo.ro.AppLoginRo;
import cn.itsource.result.JSONResult;
import cn.itsource.service.ILoginService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Tag(name = "app登录",description = "app登录")
@RestController
@RequestMapping("/app/login")
public class AppLoginController {
    @Autowired
    private ILoginService loginService;

    @Operation( summary= "微信Login",description = "微信登录对象接口")
    @Parameter(name = "login",description = "微信登录对象接口",required = true)
    @SaIgnore
    @PostMapping("/appLogin")
    public JSONResult appLogin(@RequestBody @Valid AppLoginRo loginRo){
        return (loginService.appLogin(loginRo));
    }

    /**
     * 测试 鉴定权限
     * @return
     */
    @GetMapping
    @SaCheckPermission("user-list")
    public JSONResult test(){
        return (loginService.test());
    }
}
